<?php

class Datagrid_ItensControl_Default extends Datagrid_ItensControlStrategy {
	public function aplicarItensControl($total_registros, $nome_pagina, $param_itens_por_pagina){
		$select = '<select name="itens_por_pagina" id="itens_por_pagina" onchange="Sofia.ConfigItensPorPagina(this, \'' . $nome_pagina . '\')">';
										
		$options = '';
		//$param_itens_por_pagina = $this->itens_por_pagina;

		for($i = 0; $i < 4; $i++){
			if($i == 0){
				if($param_itens_por_pagina == 20){
					$options .= "<option value='20' selected='selected'>20</option>";
				}else{
					$options .= "<option value='20'>20</option>";
				}
			}
			if($i == 1){
				if($param_itens_por_pagina == 50){
					$options .= "<option value='50' selected='selected'>50</option>";
				}else{
					$options .= "<option value='50'>50</option>";
				}
			}
			if($i == 2){
				if($param_itens_por_pagina == 100){
					$options .= "<option value='100' selected='selected'>100</option>";
				}else{
					$options .= "<option value='100'>100</option>";
				}
			}
			if($i == 3){
				if($param_itens_por_pagina == $total_registros){
					$options .= "<option value='$total_registros' selected='selected'>Todos</option>";
				}else{
					$options .= "<option value='$total_registros'>Todos</option>";
				}
			}
		}

		$select .= $options . "</select>";
		return $select;
	}
}